package com.kernelstudio.framework.compatible.supports.liquibase.database;
/*
 * This file is part of the kernelstudio package.
 *
 * (c) 2014-2024 zlin <admin@kernelstudio.com>
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 */

import com.kernelstudio.framework.compatible.DatabaseCompatibleMode;
import com.kernelstudio.framework.compatible.configurer.CompatibleConfigurer;
import liquibase.database.DatabaseFactory;

/**
 * 处理liquibase中人大金仓数据库的兼容
 */
public class LiquibaseKingBase8DatabaseCompatibleConfigurer implements CompatibleConfigurer {

    @Override
    public void configure(DatabaseCompatibleMode databaseCompatibleMode) {
        switch (databaseCompatibleMode) {
            case ORACLE:
                DatabaseFactory.getInstance().register(new KingBase8OracleDatabase());
                break;
            case MYSQL:
                DatabaseFactory.getInstance().register(new KingBase8MySQLDatabase());
                break;
            case POSTGRES:
                DatabaseFactory.getInstance().register(new KingBase8PostgresDatabase());
                break;
            default:
                throw new RuntimeException("Unknown database mode " + databaseCompatibleMode);
        }
    }
}
